package com.weishi.project.training.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.weishi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.io.Serializable;
import java.util.*;


/**
 * sportsmanBodyFunction
 */
@Data
@TableName("tbl_sportsman_body_function")
public class SportsmanBodyFunction implements Serializable {
    private static final long serialVersionUID = 1L;

    /** PK */
    private Integer id;

    /** 运动员Id */
    @ApiParam(name = "运动员Id")
    private Integer sportsmanId;

    @Excel(name = "运动员姓名")
    private String sportsmanName;

    @Excel(name = "采集时间")
    private String collectionTime;

    @Excel(name = "最大摄氧量")
    private double maxOxygen;

    @Excel(name = "体重")
    private double weight;

    @Excel(name = "血红蛋白")
    private double hb;

    @Excel(name = "血尿素氨")
    private double bu;

    @Excel(name = "肌酸激酶")
    private double ck;

    /** 尿酸 */
    private double ua;

    /** 晨脉 */
    private double hr;

    @Excel(name = "血清睾酮")
    private double st;

    /** 血乳酸 */
    private double bla;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiParam(name = "开始时间")
    private Date startTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiParam(name = "结束时间/采集时间")
    private Date endTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date ctime;

    /** 血清睾酮 */
    private String tt;

    @Excel(name = "高压")
    private double hbp;

    @Excel(name = "低压")
    private double lbp;

    /**
     * 血压
     */
    private String bloodPressure;



    public static Object getMap(SportsmanBodyFunction vo) {
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> weight = new HashMap<>();
        weight.put("name","weight");
        weight.put("value",vo.getWeight());
        list.add(weight);
        Map<String,Object> hb = new HashMap<>();
        hb.put("name","hb");
        hb.put("value",vo.getHb());
        list.add(hb);
        Map<String,Object> bu = new HashMap<>();
        bu.put("name","bu");
        bu.put("value",vo.getBu());
        list.add(bu);
        Map<String,Object> ck = new HashMap<>();
        ck.put("name","ck");
        ck.put("value",vo.getCk());
        list.add(ck);
        Map<String,Object> hbp = new HashMap<>();
        hbp.put("name","hbp");
        hbp.put("value",vo.getHbp());
        list.add(hbp);
        Map<String,Object> lbp = new HashMap<>();
        lbp.put("name","lbp");
        lbp.put("value",vo.getLbp());
        list.add(lbp);
        Map<String,Object> ua = new HashMap<>();
        ua.put("name","ua");
        ua.put("value",vo.getUa());
        list.add(ua);
        Map<String,Object> hr = new HashMap<>();
        hr.put("name","hr");
        hr.put("value",vo.getHr());
        list.add(hr);
        Map<String,Object> st = new HashMap<>();
        st.put("name","st");
        st.put("value",vo.getSt());
        list.add(st);
        Map<String,Object> bla = new HashMap<>();
        bla.put("name","bla");
        bla.put("value",vo.getBla());
        list.add(bla);

        return list;
    }

    public static Object getMapTo(SportsmanBodyFunction vo) {
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> weight = new HashMap<>();
        Double max = 0.0001;
        Double min = -0.0001;
        if(!(vo.getWeight()<max)&&(vo.getWeight()>min)){
            weight.put("name","weight");
            weight.put("value",vo.getWeight());
            list.add(weight);
        }
        Map<String,Object> hb = new HashMap<>();
        if(!(vo.getHb()<max)&&(vo.getHb()>min)){
            hb.put("name","hb");
            hb.put("value",vo.getHb());
            list.add(hb);
        }
        Map<String,Object> bu = new HashMap<>();
        if(!(vo.getBu()<max)&&(vo.getBu()>min)){
            bu.put("name","bu");
            bu.put("value",vo.getBu());
            list.add(bu);
        }
        Map<String,Object> ck = new HashMap<>();
        if(!(vo.getCk()<max)&&(vo.getCk()>min)){
            ck.put("name","ck");
            ck.put("value",vo.getCk());
            list.add(ck);
        }
        Map<String,Object> hbp = new HashMap<>();
        if(!(vo.getHbp()<max)&&(vo.getHbp()>min)){
            hbp.put("name","hbp");
            hbp.put("value",vo.getHbp());
            list.add(hbp);
        }
        Map<String,Object> lbp = new HashMap<>();
        if(!(vo.getLbp()<max)&&(vo.getLbp()>min)){
            lbp.put("name","lbp");
            lbp.put("value",vo.getLbp());
            list.add(lbp);
        }
        Map<String,Object> ua = new HashMap<>();
        if(!(vo.getUa()<max)&&(vo.getUa()>min)){
            ua.put("name","ua");
            ua.put("value",vo.getUa());
            list.add(ua);
        }

        Map<String,Object> hr = new HashMap<>();
        if(!(vo.getHr()<max)&&(vo.getHr()>min)){
            hr.put("name","hr");
            hr.put("value",vo.getHr());
            list.add(hr);

        }

        Map<String,Object> st = new HashMap<>();
        if(!(vo.getSt()<max)&&(vo.getSt()>min)){
            st.put("name","st");
            st.put("value",vo.getSt());
            list.add(st);

        }
        Map<String,Object> bla = new HashMap<>();
        if(!(vo.getBla()<max)&&(vo.getBla()>min)){
            bla.put("name","bla");
            bla.put("value",vo.getBla());
            list.add(bla);
        }

        return list;
    }
}